
var wx = require('../jweixin-module') 
const pay = (data, succCallback, errorCallback) => {
    let config=data.config;
    let pay=data.pay;
	wx.config({
		'debug': false,
		'appId':config.appId, 
		'timestamp':config.timestamp, 
		'nonceStr':config.nonceStr, 
		'signature':config.signature,
		'jsApiList':config.jsApiList
	}); 
   wx.ready(function(){
		wx.chooseWXPay({
			 'timestamp': pay.timeStamp, 
			 'nonceStr': pay.nonceStr,
			 'package': pay.package,
			 'signType': pay.signType, 
			 'paySign': pay.paySign,
			 success(res) {
			     succCallback(res);
			 },
			 fail(res) {
			     errorCallback(res);
			 }
		});
   });
 
   wx.error(function(res) {
        /*alert("config信息验证失败");*/
   });
}
 
export default pay;